/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import dao.OrderDao;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/ors")
public class OrderRateServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         int rate=Integer.parseInt(req.getParameter("rate"));
         int orderId=Integer.parseInt(req.getParameter("orderid"));
         Boolean bool=new OrderDao().rateOrderForm(orderId,rate);
         if(bool==false){
           resp.setContentType("text/html;charset=utf-8");
            resp.getWriter().println("<h1>评价失败！！</h1>");
            resp.getWriter().println("<a href='OrderInfo.jsp?orderid="+orderId+"'>返回订单信息页面</a>");
        }
        else{
            resp.sendRedirect("OrderInfo.jsp?orderid="+orderId);
        }
    }
   
    
}
